package losrebellos.media.cuepoint.net 
{
	import losrebellos.display.StageManager;
	import losrebellos.projects.mediaplayer.media.base.controller.IMediaController;

	import flash.events.IEventDispatcher;

	/*
	 *
	 * @author los rebellos - ben@benoitvinay.com
	 *
	 */
	public class MediaControllerCuePointManager extends CuePointManager implements IMediaControllerCuePointManager 
	{
		/*
		 *
		 * VARIABLES
		 *
		 */
		private var _mediaController:IMediaController;
		
		
		/*
		 *
		 * CONSTRUCTOR
		 *
		 */
		public function MediaControllerCuePointManager(media:IMediaController, custom:Boolean = true)
		{
			super(media, custom);
		}
		
		
		/*
		 * 
		 * PROPERTIES
		 * 
		 */
		public function set mediaController(value:IMediaController):void
		{
			media = value;
		}
		override protected function set media(value:IEventDispatcher):void 
		{		
			super.media = value;
			
			_mediaController = value as IMediaController;
		}
		
		
		/*
		 * 
		 * TIMING
		 * 
		 */
		override protected function getTimeFromMedia():Number
		{
			return _mediaController.getPercentPlayed() * _mediaController.getDuration(StageManager.getStage().frameRate);
		}
	}
}